package com.xingkeduo.pojo.enums;

import com.xingkeduo.util.pojo.base.BaseEnum;

/**分享地
 * @Description:
 * @Author:gaozifeng
 * @Date 2019/7/10 11:18
 **/
public enum ShareAimEnums implements BaseEnum {

    FRIEND(1, "分享到微信好友"),
    CIRCLE_FRIEND(2, "分享微信朋友圈");

    private int value;

    private String desc;

    public void setValue(int value) {
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    private ShareAimEnums(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static boolean validValue(String value) {
        int value_int = Integer.parseInt(value);
        return validValue(value_int);
    }

    public static boolean validValue(int value) {
        ShareAimEnums[] enums = ShareAimEnums.values();
        for (int i = 0; i < enums.length; i++) {
            if (enums[i].getValue() == value)
                return true;
        }
        return false;
    }

    public static ShareAimEnums getType(String value) {
        int value_int = Integer.parseInt(value);
        return getType(value_int);
    }

    public static ShareAimEnums getType(int value) {
        ShareAimEnums[] enums = ShareAimEnums.values();
        for (int i = 0; i < enums.length; i++) {
            if (enums[i].getValue() == value)
                return enums[i];
        }
        return null;
    }

    @Override
    public int getValue() {
        return this.value;
    }
}
